package com.sinoglobal.wallet.adapter;

import java.util.Map;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.sinoglobal.wallet.R;
import com.sinoglobal.wallet.entity.W_MyBankVo;

public class W_BankNameListAdapter extends W_SinoBaseSimpleAdapter<W_MyBankVo> {

	public W_BankNameListAdapter(Context mContext) {
		super(mContext);
	}

	@Override
	public void findViews(Map<java.lang.String, View> widgets, int position,
			View convertView) {
		TextView bank_name = (TextView) convertView
				.findViewById(R.id.bank_name);
		ImageView bank_name_img = (ImageView) convertView
				.findViewById(R.id.bank_name_img);
		widgets.put("bank_name", bank_name);
		widgets.put("bank_name_img", bank_name_img);
	}

	@Override
	public void setValues(View convertView, ViewHolder holder,
			Map<String, View> widgets, int position) {
		TextView bank_name = (TextView) widgets.get("bank_name");
		ImageView bank_name_img = (ImageView) widgets.get("bank_name_img");

		W_MyBankVo withDrawal_bank = (W_MyBankVo) getItem(position);
		if(withDrawal_bank.getCardSn()!=null){
		bank_name.setText(withDrawal_bank.getBankName() + "(尾号"
				+ withDrawal_bank.getCardSn().substring(withDrawal_bank.getCardSn().toCharArray().length-4, withDrawal_bank.getCardSn().toCharArray().length) + ")");
		
		}if (withDrawal_bank.getIsShow()) {
			bank_name_img.setVisibility(View.VISIBLE);
		} else {
			bank_name_img.setVisibility(View.INVISIBLE);
		}

	}

	@Override
	public View setAdapterLayout(LayoutInflater inflater, int position) {
		return inflater.inflate(R.layout.wallet_bankname_list_item_layout, null);
	}

}
